package org.catlabs.Remember.task;

import java.util.ArrayList;
import java.util.Date;

import org.catlabs.tracker.domain.Comment;
import org.catlabs.tracker.domain.TalkRef;
import org.catlabs.tracker.domain.Task;
import org.catlabs.tracker.domain.TaskRef;
import org.catlabs.tracker.domain.UserRef;

import cucumber.api.PendingException;
import cucumber.api.java.Before;
import cucumber.api.java.en.Given;
import cucumber.api.java.en.Then;
import cucumber.api.java.en.When;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertEquals;

public class Comments {

	private Comment comment;
	private Task task;
	
	@Before
	public void before(){
		comment = new Comment();
		task = new Task(); 
	}
	
	@Given("^comments have a unique id$")
	public void comments_have_a_unique_id() throws Throwable {
	    comment.setId(123);
	}

	@Given("^comments have a text$")
	public void comments_have_a_text() throws Throwable {
	    comment.setText("Could you please provide me the updated requirements document.");
	}

	@Given("^comments have a creator id$")
	public void comments_have_a_creator_id() throws Throwable {
		UserRef userReference = new UserRef(1);
		comment.setCreatorId(userReference);
	}

	@Given("^comments have a creation date and time$")
	public void comments_have_a_creation_date_and_time() throws Throwable {
	    Date now = new Date();
	    comment.setCreation(now);
	}

	@Given("^comments have a list of related comments on their own$")
	public void comments_have_a_list_of_related_comments_on_their_own() throws Throwable {
	    comment.setReplies(new ArrayList<Comment>());
	}

	@Given("^comments can have zero or more references to: talks$")
	public void comments_can_have_zero_or_more_references_to_talks() throws Throwable {
	    comment.setTalks(new ArrayList<TalkRef>());
	}

	@Given("^comments can have zero or more references to: tasks$")
	public void comments_can_have_zero_or_more_references_to_tasks() throws Throwable {
	    comment.setTasks(new ArrayList<TaskRef>());
	}
	
	// ----------------------------------
	
	@Given("^an existing task$")
	public void an_existing_task() throws Throwable {
	    assertNotNull(task);
	}

	@When("^adding a comment at the task level$")
	public void adding_a_comment_at_the_task_level() throws Throwable {
	    // Express the Regexp above with the code you wish you had
	    throw new PendingException();
	}

	@Then("^the new comment is saved$")
	public void the_new_comment_is_saved() throws Throwable {
	    // Express the Regexp above with the code you wish you had
	    throw new PendingException();
	}

	@Then("^the new comment text matches the one entered$")
	public void the_new_comment_text_matches_the_one_entered() throws Throwable {
	    // Express the Regexp above with the code you wish you had
	    throw new PendingException();
	}

	@Then("^the creator id is the current user id$")
	public void the_creator_id_is_the_current_user_id() throws Throwable {
	    // Express the Regexp above with the code you wish you had
	    throw new PendingException();
	}

	@Then("^the creator date and time is now$")
	public void the_creator_date_and_time_is_now() throws Throwable {
	    // Express the Regexp above with the code you wish you had
	    throw new PendingException();
	}

	@Then("^the list of related comments is empty$")
	public void the_list_of_related_comments_is_empty() throws Throwable {
	    // Express the Regexp above with the code you wish you had
	    throw new PendingException();
	}

	@Then("^is the last in the comments list$")
	public void is_the_last_in_the_comments_list() throws Throwable {
	    // Express the Regexp above with the code you wish you had
	    throw new PendingException();
	}

	@Given("^an existing task with a comment$")
	public void an_existing_task_with_a_comment() throws Throwable {
	    // Express the Regexp above with the code you wish you had
	    throw new PendingException();
	}

	@When("^adding a reply to the comment$")
	public void adding_a_reply_to_the_comment() throws Throwable {
	    // Express the Regexp above with the code you wish you had
	    throw new PendingException();
	}

	@Then("^the reply is saved$")
	public void the_reply_is_saved() throws Throwable {
	    // Express the Regexp above with the code you wish you had
	    throw new PendingException();
	}

	@Then("^is the last in the replies list$")
	public void is_the_last_in_the_replies_list() throws Throwable {
	    // Express the Regexp above with the code you wish you had
	    throw new PendingException();
	}
	
}
